19. Quiz: Last Check

I recommend testing your queries with the environment below, and then saving them to a file. Then compare your file to my solutions on the next concept!
If you have two or more columns in your SELECT that have the same name after the table name such as accounts.name and sales_reps.name you will need to alias them. Otherwise it will only show one of the columns. You can alias them like accounts.name AS AcountName, sales_rep.name AS SalesRepName
Questions
-
Provide a table that provides the
region
for each
sales_rep
along with their associated
accounts
. This time only for the
Midwest
region. Your final table should include three columns: the region name , the sales rep name , and the account name . Sort the accounts alphabetically (A-Z) according to account name.
-
Provide a table that provides the
region
for each
sales_rep
along with their associated
accounts
. This time only for accounts where the sales rep has a first name starting with
S
and in theMidwest
region. Your final table should include three columns: the region name , the sales rep name , and the account name . Sort the accounts alphabetically (A-Z) according to account name.
-
Provide a table that provides the
region
for each
sales_rep
along with their associated
accounts
. This time only for accounts where the sales rep has a
last
name starting with
K
and in theMidwest
region. Your final table should include three columns: the region name , the sales rep name , and the account name . Sort the accounts alphabetically (A-Z) according to account name.
-
Provide the
name
for each region for every
order
, as well as the account
name
and the
unit price
they paid (total_amt_usd/total) for the order. However, you should only provide the results if the
standard order quantity
exceeds
100
. Your final table should have 3 columns: region name , account name , and unit price . In order to avoid a division by zero error, adding .01 to the denominator here is helpful total_amt_usd/(total+0.01).
-
Provide the
name
for each region for every
order
, as well as the account
name
and the
unit price
they paid (total_amt_usd/total) for the order. However, you should only provide the results if the
standard order quantity
exceeds
100
and the poster order quantity exceeds50
. Your final table should have 3 columns: region name , account name , and unit price . Sort for the smallest unit price first. In order to avoid a division by zero error, adding .01 to the denominator here is helpful (total_amt_usd/(total+0.01).
-
Provide the
name
for each region for every
order
, as well as the account
name
and the
unit price
they paid (total_amt_usd/total) for the order. However, you should only provide the results if the
standard order quantity
exceeds
100
and the poster order quantity exceeds50
. Your final table should have 3 columns: region name , account name , and unit price . Sort for the largest unit price first. In order to avoid a division by zero error, adding .01 to the denominator here is helpful (total_amt_usd/(total+0.01).
-
What are the different
channel
s used by
account id
1001
? Your final table should have only 2 columns: account name and the different channel s. You can try SELECT DISTINCT to narrow down the results to only the unique values.
-
Find all the orders that occurred in
2015
. Your final table should have 4 columns: occurred_at , account name , order total , and order total_amt_usd .
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: sql-evaluator
- Opened files (when workspace is loaded): n/a